package com.aaa.controller;


import com.aaa.entity.Role;
import com.aaa.service.RoleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;


@CrossOrigin
@Controller
@RequestMapping("role")
public class RoleController {
    @Resource
    RoleService roleService;
    @RequestMapping("list")
    @ResponseBody
    public List<Role> list(){
        return roleService.list();
    }
    @RequestMapping("save")
    @ResponseBody
    public boolean save(Role role){
        return roleService.save(role);
    }
    @RequestMapping("update")
    @ResponseBody
    public boolean update(Role role){
        return roleService.updateById(role);
    }
    @RequestMapping("remove")
    @ResponseBody
    public boolean remove(Integer rid){
        return roleService.removeById(rid);
    }
}
